ActionController::Routing::Routes.draw do |map|
  #map.resources :users
  map.resource :session
  map.resource :search
  map.resources :posts
  map.resources :orders, :collection=>{:question=>:post}
  
  map.namespace :admin do |admin|
  	admin.resources :categories, :has_one=>[:page]
  	admin.resources :posts
  	admin.resources :orders
  end
  
  map.connect '/admin', :controller => 'admin/categories'
  map.signup '/signup', :controller => 'users', :action => 'new'
	map.login '/login', :controller => 'sessions', :action => 'new'
	map.logout '/logout', :controller => 'sessions', :action => 'destroy'
	map.simple_captcha '/simple_captcha/:action', :controller => 'simple_captcha'
	
	map.connect '/calculator', :controller=>'welcome', :action=>'calculator'
	map.connect '/calculeted', :controller=>'welcome', :action=>'calculeted', :conditions => { :method => :post }
	
  map.category '/:category_id', :controller=>'category'
  map.connect '/:parent_category_id/:category_id', :controller=>"category"
  map.connect '/*path/:parent_category_id/:category_id', :controller=>"category"
  map.root :controller => "welcome"

  # See how all your routes lay out with "rake routes"

  # Install the default routes as the lowest priority.
  map.connect ':controller/:action/:id'
end
